package svc

import (
	"3kz/api/internal/config"
	"3kz/api/internal/middleware"
	"3kz/zk3rpc/zk3rpcclient"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config              config.Config
	Zk3Rpc              zk3rpcclient.Zk3rpc
	UserAgentMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		Zk3Rpc:              zk3rpcclient.NewZk3rpc(zrpc.MustNewClient(c.Zk3Rpc)),
		UserAgentMiddleware: middleware.NewUserAgentMiddleware().Handle,
	}
}
